<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'编辑客户'))}
	<div class="frame">
		<form method='post' id="form_data" >
			<input type="hidden" name="opmode" value="edit">
			<input type="hidden" name="id" id="id" value="{$vo.id}">
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="name">姓名*：</label>
						
							<input class="input" type="text" id="name" name="name"value="{$vo.name}"
							check="required" info="请输入姓名">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="company">公司：</label>
						<input type="hidden" id="company_id" name="company_id" check="required" value="{$vo.company_id}" info="请选择公司">
						<input type="hidden" id="company_name" name="company_name"value="{$vo.company_name}" >
						
							<input type="text" class="input" value="{$vo.company_name}"  id="company">
							<span class="caret add-on"></span>
							<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
						</div>
						<!-- /btn-group -->
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="dept">部门：</label>
						
							<input class="input" type="text" id="dept"  name="dept"  value="{$vo.dept}">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="position">职位：</label>
						
							<input class="input" type="text" id="position" name="position"  value="{$vo.position}">
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="office_tel">办公电话*：</label>
						
							<input class="input" type="text" id="office_tel" name="office_tel" value="{$vo.office_tel}" check="required" info="请输入办公电话">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="mobile_tel">手机：</label>
						
							<input class="input" type="text" id="mobile_tel" value="{$vo.mobile_tel}"
							name="mobile_tel">
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="email">邮件*：</label>
						
							<input class="input" type="text" id="email" name="email" value="{$vo.email}"
							check="required" info="请输入邮件">
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="im">即时聊天：</label>
						
							<input class="input" type="text" id="im" name="im" value="{$vo.im}">
						</div>
					</div>
				</div>
			</div>
			<hr>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="address">产品：</label>
						<div class="input-block x-select">
							<select class="input" id="product" name="product" info="请选择产品产品"
							check="required">
								<option>请选择</option>
								<volist name="product" id="group">
									<optgroup label="{$key}">
										<volist name="group" id="pvo">
											<option value="{$pvo}">{$pvo}</option>
										</foreach>
									</optgroup>
								</foreach>
							</select>
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="salesman">业务员：</label>
						<input type="hidden" id="salesman_id" name="salesman_id" value="{$vo.salesman_id}"  check="required" info="请选择业务员">
						<input type="hidden" id="salesman_name" name="salesman_name" value="{$vo.salesman_name}">
						
							<input type="text" class="input" value="{$vo.salesman_name}" id="salesman">
							<div class="input-group-btn">
								<span class="add-on caret"></span>
								<ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
							</div>
							<!-- /btn-group -->
						</div>
					</div>
				</div>
			</div>
			<div class="frame">
				<volist name="field_list " id="field_vo">
					{:widget('UserDefineField/edit',array($field_vo))}
				</foreach>
			</div>
			<div class="frame">
				<div class="box col-12">
					
						<label class="input-label" for="remark">其他：</label>
						
							<textarea class="textarea simple" name="remark">{$vo.remark}</textarea>
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label" for="name">附件：</label>
						
							{:widget('file_upload/edit',array('add_file'=>$vo['add_file']))}
						</div>
					</div>
				</div>
				<div class="box col-12">
					
						<label class="input-label"></label>
						
							<a class="btn btn-normal" onclick="save()">保存</a>
							<a class="btn btn-return" onclick="go_return_url()">取消 </a>
						</div>
					</div>
				</div>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global','suggest','uploader'], function() {
			var $ = layui.jquery;
			set_val('product', '{$vo.product}');
			$("#btn_save").on('click', function() {
				send_form("form_data", "{:url('save')}", "{:url('index')}", function(ret) {
					if (ret.status) {
						layer.msg(ret.info);
						location.href = "{:url('index')}";
					} else {
						layer.msg(ret.info);
						return false;
					}
				});
			});

			$("#salesman").suggest({
				url : "{:url('get_salesman_list')}",
				callback : function(ret) {
					if (ret.status == 1) {
						$('#salesman_id').val(ret.data.key);
						$('#salesman_name').val(ret.data.val);
						$('#salesman').val(ret.data.val);
					}
				}
			});

			$("#company").suggest({
				url : "{:url('get_compnay_list')}",
				callback : function(ret) {
					if (ret.status == 1) {
						$('#company_id').val(ret.data.key);
						$('#company_name').val(ret.data.val);
						$('#company').val(ret.data.val);
					}
				}
			});
		});

	</script>
</block>